package com.cy.personer.web;

import com.cy.personer.bean.ReportItem;
import com.cy.personer.bean.Work;
import com.cy.personer.mapper.ReportSxbMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @施晓彬
 */

@Controller
@RequestMapping("/reportItem")
public class ReportItemHandler {
   // private List<Remark> remarks=null;
    @Resource
    private ReportSxbMapper reportSxbMapper;
    @Resource
    private ReportItem reportItem;
    @RequestMapping(value = "/reportItemList.action")
    public String remarkList(HttpServletRequest request, Integer num){
        HttpSession session = request.getSession();
        Work work = (Work)session.getAttribute("work");
        if(num==null||num==0){
            num=1;
        }

        PageHelper.startPage(num,5);
//        List<ReportItem> reportItems = reportSxbMapper.reportItemByWorkId(work.getWorkId());
        List<ReportItem> reportItems = reportSxbMapper.reportItemByWorkId(124);
        PageInfo<ReportItem> page = new PageInfo<>(reportItems);
        request.setAttribute("page",page);
        return "admin/report_list";
    }

//    /**
//     * ajax执行修改的Mapper成功后返回boolean的回调函数
//     * @author whl
//     */
//    @RequestMapping(value="/updateRemark1.action",method = RequestMethod.POST,produces="application/json;charset=utf-8")
//    public @ResponseBody Boolean updateRemark1( @RequestParam String remarkField1,String remarkName1,Integer remarkId1){
//       remark.setRemarkName(remarkName1);
//       remark.setRemarkField(remarkField1);
//       remark.setRemarkId(remarkId1);
//       boolean b = remarkMapper.updateById(remark);
//        if(b){
//            return true;
//        }else {
//            return false;
//        }
//    }


}
